package com.jt.feign;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author 金帮嘉诚 @date 2021-08-18 星期三 21:03
 * //此对象可以作为Feign方式的远程调用异常处理对象
 */

@Component
public class ProviderFallbackFactory implements FallbackFactory<RemoteProviderService>{
    @Override
    public RemoteProviderService create(Throwable throwable) {
//        return (msg) -> {
//            return "服务维修中";
//        };
        return new RemoteProviderService() {
            @Override
            public String feignEcho(String msg) {
                return "服务维修中...";
            }

            @Override
            public String day04Echo() {
                return "服务day04Echo维修中";
            }
        };
    }
}
